import request from '@/plugins/request';


//页面加载获取所有英雄列表
export function getAllChampion() {
    return request.get('/champion/getAllChampion')
}
//根据职业选择英雄
export function getChampionByJob(job) {
    return request.get(`/champion/sel-job/${job}`)
}
//根据名字选择英雄
export function getChampionByTitle(title) {
    return request.get('/champion/getChampionByTitle',{
        params: {title:title}
    })
}




// 获取英雄列表
export function listChampion(
    {
        pageNum = 0,
        pageSize = 20,
        type = 'all',
        find = "",
    } = {}) {
    return request.get('/champion', {
        params: { pageNum, pageSize, type ,find }
    })
}

// 根据 id 删除英雄（建议使用逻辑删除）
export function deleteChampionById(id) {
    return request.delete(`/champion/deleteChampionById/${id}`)
}

// 根据 id 获取英雄详情
export function getChampionById(id) {
    return request.get(`/champion/sel-id`,{
        params: { id }
    })
}

// 更新英雄数据
export function updateChampion(champion) {
    return request.post('/champion/updateChampionById', champion)
}

// 新增英雄
export function newChampion(champion) {
    return request.post('/champion/insertChampion', champion)
}

// 恢复已删除英雄
export  function regainChampion(id) {
    return request.put(`/champion/regainChampion/${id}`)
}